import request from '@/request/request'

// 分页查询盘点单
export function getInventoryCheckPage(params) {
  return request({ method: 'get', url: '/check/inventory/page', params })
}

// 获取盘点单详情（含明细）
export function getInventoryCheckWithDetails(id) {
  return request({ method: 'get', url: `/check/inventory/withDetails/${id}` })
}

// 创建盘点单
export function createInventoryCheck(data) {
  return request({ method: 'post', url: '/check/inventory', data })
}

// 更新盘点单
export function updateInventoryCheck(data) {
  return request({ method: 'put', url: '/check/inventory', data })
}

// 删除盘点单
export function deleteInventoryCheck(id) {
  return request({ method: 'delete', url: `/check/inventory/${id}` })
}

// 审核盘点单
export function auditInventoryCheck(id) {
  return request({ method: 'put', url: `/check/inventory/audit/${id}` })
}

// 获取商品在指定仓库的系统库存数量
export function getProductStockQuantity(productId, warehouseId) {
  return request({ method: 'get', url: `/check/inventory/stock/${productId}/${warehouseId}` })
}
